<template>
	<view class="invite_wrap">
		<u-empty-state v-if="invie_data.length == 0" value="暂无相关记录"></u-empty-state>
		<view class="item" v-for="value in invie_data" :key="value.userId">
			<view>
				<image :src="value.picture" mode="scaleToFill" />
			</view>
			<view>
				<view>{{ value.userName }}</view>
				<view>{{ value.createdTime }}</view>
			</view>
			<view>入驻成功</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			pageNo: 1,
			total: 0,
			invie_data: [],
		}
	},
	onReachBottom() {
		if (this.pageNo * 10 < this.total) {
			this.pageNo++
			this.getInviteList()
		}
	},
	onShow() {
		this.getInviteList()
	},
	methods: {
		getInviteList() {
			this.$api.getInviteList({ pageNo: this.pageNo, pageSize: 10 }).then(e => {
				const { code, result: { records, total } } = e
				if (code == 200) {
					this.total = total
					this.invie_data.push.apply(this.invie_data, records);
				} else {
					uni.showToast({
						title: e.message,
						icon: 'none'
					});
				}
			})
		}
	}
}
</script>

<style lang="less">
@import './inviteList.less';
</style>
